﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="BlogControl.aspx.cs" Inherits="NuaTarDoneng.BlogControl" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style23
        {
            width: 100%;
            color: #000000;
            background-color: #FFFFFF;
        }
        .style24
        {
            width: 500px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        DeleteCommand="DELETE FROM [blogSort] WHERE [blogSortID] = @original_blogSortID AND (([blogSort] = @original_blogSort) OR ([blogSort] IS NULL AND @original_blogSort IS NULL))" 
        InsertCommand="INSERT INTO [blogSort] ([blogSortID], [blogSort]) VALUES (@blogSortID, @blogSort)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [blogSort]" 
        UpdateCommand="UPDATE [blogSort] SET [blogSort] = @blogSort WHERE [blogSortID] = @original_blogSortID AND (([blogSort] = @original_blogSort) OR ([blogSort] IS NULL AND @original_blogSort IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_blogSortID" Type="String" />
            <asp:Parameter Name="original_blogSort" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="blogSortID" Type="String" />
            <asp:Parameter Name="blogSort" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="blogSort" Type="String" />
            <asp:Parameter Name="original_blogSortID" Type="String" />
            <asp:Parameter Name="original_blogSort" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <table class="style23">
        <tr>
            <td class="style24">
                <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                    BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" 
                    CellPadding="3" DataKeyNames="blogSortID" DataSourceID="SqlDataSource2" 
                    GridLines="Horizontal" onrowdeleted="GridView2_RowDeleted" Width="489px">
                    <AlternatingRowStyle BackColor="#F7F7F7" />
                    <Columns>
                        <asp:BoundField DataField="blogSortID" HeaderText="blogSortID" ReadOnly="True" 
                            SortExpression="blogSortID" />
                        <asp:BoundField DataField="blogSort" HeaderText="blogSort" 
                            SortExpression="blogSort" />
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                    </Columns>
                    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <SortedAscendingCellStyle BackColor="#F4F4FD" />
                    <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
                    <SortedDescendingCellStyle BackColor="#D8D8F0" />
                    <SortedDescendingHeaderStyle BackColor="#3E3277" />
                </asp:GridView>
            </td>
            <td>
                添加新的分类：<br />
                <asp:TextBox ID="TextBox1" runat="server" Width="170px"></asp:TextBox>
                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="添加" />
            </td>
        </tr>
    </table>
    <hr style="height: 7px; color: #000000; background-color: #000000" />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" 
        CellPadding="3" CellSpacing="2" DataKeyNames="blogID" 
        DataSourceID="SqlDataSource1" Width="925px" 
        onrowdeleting="GridView1_RowDeleting" onrowdeleted="GridView1_RowDeleted">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" />
            <asp:BoundField DataField="blogTitle" HeaderText="blogTitle" 
                SortExpression="blogTitle" />
            <asp:BoundField DataField="keyword" HeaderText="keyword" 
                SortExpression="keyword" />
            <asp:TemplateField HeaderText="编辑">
                <ItemTemplate>
                    
                    <a href="AdminWrite.aspx?id=<%# Eval("blogID") %>">编辑</a>&nbsp;&nbsp;
                    
                   
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
        <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
        <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
        <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#FFF1D4" />
        <SortedAscendingHeaderStyle BackColor="#B95C30" />
        <SortedDescendingCellStyle BackColor="#F1E5CE" />
        <SortedDescendingHeaderStyle BackColor="#93451F" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        DeleteCommand="DELETE FROM [blogs] WHERE [blogID] = @blogID" 
        InsertCommand="INSERT INTO [blogs] ([blogID], [blogTitle], [blogContent], [blogTime], [SortID], [keyword]) VALUES (@blogID, @blogTitle, @blogContent, @blogTime, @SortID, @keyword)" 
        SelectCommand="SELECT * FROM [blogs] ORDER BY [blogTitle] DESC" 
        UpdateCommand="UPDATE [blogs] SET [blogTitle] = @blogTitle, [blogContent] = @blogContent, [blogTime] = @blogTime, [SortID] = @SortID, [keyword] = @keyword WHERE [blogID] = @blogID">
        <DeleteParameters>
            <asp:Parameter Name="blogID" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="blogID" Type="String" />
            <asp:Parameter Name="blogTitle" Type="String" />
            <asp:Parameter Name="blogContent" Type="String" />
            <asp:Parameter Name="blogTime" Type="DateTime" />
            <asp:Parameter Name="SortID" Type="String" />
            <asp:Parameter Name="keyword" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="blogTitle" Type="String" />
            <asp:Parameter Name="blogContent" Type="String" />
            <asp:Parameter Name="blogTime" Type="DateTime" />
            <asp:Parameter Name="SortID" Type="String" />
            <asp:Parameter Name="keyword" Type="String" />
            <asp:Parameter Name="blogID" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
